﻿@model CleverCMS.Cms.Services.ViewModels.DashboardViewModel

@section TitleContent
{
    Dashboard
}
@section HeadContent
{
    <!-- Charts -->
    <script src="@Url.Content("~/Areas/CleverCms.Admin/Content/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js")" type="text/javascript"></script>
    <link   href="@Url.Content("~/Areas/CleverCms.Admin/Content/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css")" media="screen" type="text/css" rel="stylesheet">
    <script src="@Url.Content("~/Areas/CleverCms.Admin/Content/assets/chart-master/Chart.js")" type="text/javascript"></script>
}
@section NavigationLink
{
   <article class="breadcrumbs"><a class="current" href="@Url.Action("Index")">Website Admin</a><div class="breadcrumb_divider"></div><a class="current">Dashboard</a></article>
}

<div class="row-fluid">
    <div class="metro-nav">
        <div class="metro-nav-block nav-block-yellow">
            <a data-original-title="" href="@Url.Action("Edit", "Page", new { area = "CleverCms.Admin" })">
                <i class="icon-tags"></i>
                <div class="status">New Page</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-orange">
            <a data-original-title="" href="@Url.Action("Edit", "Accounts", new { area = "CleverCms.Admin" })">
                <i class="icon-user"></i>
                <div class="status">New User</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-grey">
            <a data-original-title="" href="@Url.Action("Edit", "Blog", new { area = "CleverCms.Admin" })">
                <i class="icon-comments-alt"></i>
                <div class="status">New Blog</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-blue double">
            <a data-original-title="" href="@Url.Action("Edit", "MenuItem", new { area = "CleverCms.Admin" })">
                <i class="icon-eye-open"></i>
                <div class="status">New Menu Item</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-red">
            <a data-original-title="" href="@Url.Action("Edit", "Settings", new { area = "CleverCms.Admin" })">
                <i class="icon-bar-chart"></i>
                <div class="status">New Widget</div>
            </a>
        </div>
    </div>

    <div class="metro-nav">
        <div class="metro-nav-block nav-block-green">
            <a data-original-title="" href="@Url.Action("List", "Page", new { area = "CleverCms.Admin" })">
                <i class="icon-tasks"></i>
                <div class="info">@Model.Pages</div>
                <div class="status">List pages</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-blue double">
            <a data-original-title="" href="@Url.Action("List", "Accounts", new { area = "CleverCms.Admin" })">
                <i class="icon-shopping-cart"></i>
                <div class="info">@Model.Users</div>
                <div class="status">List users</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-orange">
            <a data-original-title="" href="@Url.Action("List", "Blog", new { area = "CleverCms.Admin" })">
                <i class="icon-envelope"></i>
                <div class="info">@Model.Blogs</div>
                <div class="status">List blogs</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-purple">
            <a data-original-title="" href="@Url.Action("List", "MenuItem", new { area = "CleverCms.Admin", id = 3 })">
                <i class="icon-remove-sign"></i>
                <div class="info">@Model.Menues</div>
                <div class="status">List Menues</div>
            </a>
        </div>
        <div class="metro-nav-block nav-block-grey">
            <a data-original-title="" href="@Url.Action("List", "Settings", new { area = "CleverCms.Admin" })">
                <i class="icon-external-link"></i>
                <div class="info">@Model.Widgets</div>
                <div class="status">List widgets</div>
            </a>
        </div>
    </div>
    <div class="space10"></div>
</div>
<div class="row-fluid">
    <div class="span6">
        <div class="widget ">
            <div class="widget-title">
                <h4><i class="icon-reorder"></i> Views counter</h4>
                <span class="tools">
                    <a href="javascript:;" class="icon-chevron-down"></a>
                    <a href="javascript:;" class="icon-remove"></a>
                </span>
            </div>
            <div class="widget-body">
                <div class="row-fluid">
                    <div class="span8">
                        <div class="text-center">
                            <canvas id="doughnut" height="300" width="400" style="width: 400px; height: 300px;"></canvas>
                        </div>
                    </div>
                    <div class="span4">
                        <p style="color: #FFF; text-align: center; margin-top: 120px;"><b style="background-color: #74B749; padding: 5px;">Pages views (@Model.PagesViewCount)</b></p>
                        <p style="color: #FFF; text-align: center"><b style="background-color: #f37b53; padding: 7px;">Blog views (@Model.PostsViewCount)</b></p> 
                    </div>  
                </div>
            </div>
        </div>
    </div>
    <div class="span6">
        <div class="widget blue">
            <div class="widget-title">
                <h4><i class="icon-bell"></i> Last Errors</h4>
                <span class="tools">
                    <a href="javascript:;" class="icon-chevron-down"></a>
                    <a href="javascript:;" class="icon-remove"></a>
                </span>
            </div>
            <div class="widget-body">
                @if (Model.Logs.Any())
                {
                    <div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 285px;">
                        <ul class="item-list scroller padding" style="overflow: hidden; width: auto; height: 285px;" data-always-visible="1">
                            @foreach (var log in Model.Logs)
                            {
                                <li>
                                    <span class="label @(log.Level.Contains("WARN") ? "label-warning" : log.Level.Contains("INFO") ?  "label-success" :  "label-important")"><i class="@(log.Level.Contains("WARN") ? "icon-bullhorn" : log.Level.Contains("INFO") ? "icon-bell" : "icon-bug")"></i></span>
                                    <span>@log.Message</span>
                                    <div class="pull-right">
                                        <span class="small italic ">@log.Date.ToString("g")</span>
                                    </div>
                                </li> 
                            }            
                        </ul>
                    </div>
                    <a href="@Url.Action("List", "Monitor", new { area = "CleverCms.Admin" })" style="margin-left: 10px;">Go to Monitor</a>
                    <div class="clearfix no-top-space no-bottom-space"></div>
                }
                else
                {
                    <div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 285px;">
                        <ul class="item-list scroller padding" style="overflow: hidden; width: auto; height: 285px;" data-always-visible="1">
                            <p>Logs is empty!</p>             
                        </ul>
                    </div>   
                }
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        var doughnutData = [{ value: @Model.PagesViewCount, color: "#74B749" }, { value: @Model.PostsViewCount, color: "#f37b53" }];
        new Chart(document.getElementById("doughnut").getContext("2d")).Doughnut(doughnutData);
    });
</script>